/*    */ package net.gxf.java2dgame.move;
/*    */ 
/*    */ import java.awt.event.KeyEvent;
/*    */ import java.awt.image.BufferedImage;
/*    */ import java.io.IOException;
/*    */ import javax.imageio.ImageIO;
/*    */ import javax.swing.ImageIcon;
/*    */ 
/*    */ public class Craft
/*    */ {
/* 11 */   private String craft = "craft.png";
/*    */   private int dx;
/*    */   private int dy;
/*    */   private int x;
/*    */   private int y;
/*    */   private BufferedImage image;
/*    */ 
/*    */   public Craft()
/*    */   {
/* 20 */     ImageIcon ii = new ImageIcon(getClass().getClassLoader().getResource(this.craft));
/*    */     try {
/* 22 */       this.image = ImageIO.read(getClass().getClassLoader().getResourceAsStream(this.craft));
/*    */     }
/*    */     catch (IOException e)
/*    */     {
/*    */     }
/* 27 */     this.x = 40;
/* 28 */     this.y = 60;
/*    */   }
/*    */ 
/*    */   public void move()
/*    */   {
/* 33 */     this.x += this.dx;
/* 34 */     this.y += this.dy;
/*    */   }
/*    */ 
/*    */   public int getX() {
/* 38 */     return this.x;
/*    */   }
/*    */ 
/*    */   public int getY() {
/* 42 */     return this.y;
/*    */   }
/*    */ 
/*    */   public BufferedImage getImage() {
/* 46 */     return this.image;
/*    */   }
/*    */ 
/*    */   public void keyPressed(KeyEvent e)
/*    */   {
/* 51 */     int key = e.getKeyCode();
/*    */ 
/* 53 */     if (key == 37) {
/* 54 */       this.dx = -1;
/*    */     }
/*    */ 
/* 57 */     if (key == 39) {
/* 58 */       this.dx = 1;
/*    */     }
/*    */ 
/* 61 */     if (key == 38) {
/* 62 */       this.dy = -1;
/*    */     }
/*    */ 
/* 65 */     if (key == 40)
/* 66 */       this.dy = 1;
/*    */   }
/*    */ 
/*    */   public void keyReleased(KeyEvent e)
/*    */   {
/* 71 */     int key = e.getKeyCode();
/*    */ 
/* 73 */     if (key == 37) {
/* 74 */       this.dx = 0;
/*    */     }
/*    */ 
/* 77 */     if (key == 39) {
/* 78 */       this.dx = 0;
/*    */     }
/*    */ 
/* 81 */     if (key == 38) {
/* 82 */       this.dy = 0;
/*    */     }
/*    */ 
/* 85 */     if (key == 40)
/* 86 */       this.dy = 0;
/*    */   }
/*    */ }

/* Location:           C:\DBDownload\lwjglDemo2\lwjglDemo2\Run.jar
 * Qualified Name:     com.java2dgame.move.Craft
 * JD-Core Version:    0.6.2
 */